<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    {# 生成随机令牌, 保存到session中/jinja2里面使用 #}
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>用户中心</title>
    <link rel="stylesheet" type="text/css" href="../../static/news/css/reset.css">
    <link rel="stylesheet" type="text/css" href="../../static/news/css/main.css">
    <script type="text/javascript" src="../../static/news/js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="../../static/news/js/jquery.form.min.js"></script>
    <script type="text/javascript" src="../../static/news/js/user_pic_info.js"></script>
    {# 将令牌设置到请求头中 #}
    <script type="text/javascript" src="../../static/news/js/csrf.js"></script>
</head>

<body class="inframe_body">
<form class="pic_info">
    <h3>头像设置</h3>
    <div class="form-group">
        <label class="label01">当前图像：</label>
        <img {% if user.avatar_url %}src="{{ user.avatar_url }}"
             {% else %}src="../../static/news/images/user_pic.png"{% endif %} alt="用户图片" class="now_user_pic">
    </div>
    <div class="form-group">
        <label>上传图像：</label>
        <input type="file" name="avatar" class="input_file">
    </div>
    <div class="form-group">
        <input type="submit" value="保 存" class="input_sub">
        {# 生成令牌, 保存到session中, 并且返回给表单 #}
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
    </div>
</form>
</body>

</html>